package com.dinzeer.resonantisshelomoh.regsiter;

import com.dinzeer.resonantisshelomoh.Resonantisshelomoh;
import mods.flammpfeil.slashblade.SlashBlade;
import mods.flammpfeil.slashblade.ability.StunManager;
import mods.flammpfeil.slashblade.init.DefaultResources;
import mods.flammpfeil.slashblade.registry.combo.ComboState;
import mods.flammpfeil.slashblade.util.AttackManager;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

import static com.dinzeer.resonantisshelomoh.Resonantisshelomoh.MODID;

public class RSComboState {
    public static final DeferredRegister<ComboState> COMBO_STATES =
            DeferredRegister.create(ComboState.REGISTRY_KEY,MODID);


    public static final RegistryObject<ComboState> ALL_REUSE = COMBO_STATES.register
            (
                    "all_reuse",
                    ComboState.Builder.newInstance().startAndEnd(459, 488).priority(50)
                            .motionLoc(DefaultResources.ExMotionLocation).next(entity -> SlashBlade.prefix("none"))
                            .nextOfTimeout(entity -> SlashBlade.prefix("none"))
                            .addTickAction(ComboState.TimeLineTickAction.getBuilder().put(0, AttackManager::playQuickSheathSoundAction).build())
                            .releaseAction(ComboState::releaseActionQuickCharge)::build
            );

    public static final RegistryObject<ComboState> ALLOVER = COMBO_STATES.register("all_over",
            ComboState.Builder.newInstance().startAndEnd(400, 459).priority(50)
                    .motionLoc(DefaultResources.ExMotionLocation)
                    .next(ComboState.TimeoutNext.buildFromFrame(15, entity -> SlashBlade.prefix("none")))
                    .nextOfTimeout(entity -> Resonantisshelomoh.prefix("all_reuse"))
                    .addTickAction(ComboState.TimeLineTickAction.getBuilder()
                            .put(1, (entityIn) -> AttackManager.doSlash(entityIn, -30F, Vec3.ZERO, false, false, 0.1F))
                            .put(2, (entityIn) -> AttackManager.doSlash(entityIn, 30F, Vec3.ZERO, false, false, 0.1F))
                            .put(3, (entityIn) -> AttackManager.doSlash(entityIn, -40F, Vec3.ZERO, false, false, 0.1F))
                            .put(4, (entityIn) -> AttackManager.doSlash(entityIn, 40F, Vec3.ZERO, false, false, 0.1F))
                            .put(5, (entityIn) -> AttackManager.doSlash(entityIn, 50F, Vec3.ZERO, false, false, 0.1F))
                            .put(6, (entityIn) -> AttackManager.doSlash(entityIn, -50F, Vec3.ZERO, false, false, 0.1F))
                            .put(7, (entityIn) -> AttackManager.doSlash(entityIn, -60F, Vec3.ZERO, false, false, 0.1F))
                            .put(8, (entityIn) -> AttackManager.doSlash(entityIn, 60F, Vec3.ZERO, false, false, 0.1F))
                            .put(9, (entityIn) -> AttackManager.doSlash(entityIn, -70F, Vec3.ZERO, false, false, 0.1F))
                            .put(10, (entityIn) -> AttackManager.doSlash(entityIn, 70F, Vec3.ZERO, false, false, 0.1F))
                            .put(11, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.1F))
                            .put(12, (entityIn) -> AttackManager.doSlash(entityIn, -90F, Vec3.ZERO, false, false, 0.1F))
                            .put(13, (entityIn) -> AttackManager.doSlash(entityIn, 110F, Vec3.ZERO, false, false, 0.1F))
                            .put(14, (entityIn) -> AttackManager.doSlash(entityIn, -110F, Vec3.ZERO, false, false, 0.1F))
                            .put(15, (entityIn) -> AttackManager.doSlash(entityIn, 120F, Vec3.ZERO, false, false, 0.1F))
                            .put(16, (entityIn) -> AttackManager.doSlash(entityIn, -120F, Vec3.ZERO, false, false, 0.1F))
                            .put(17, (entityIn) -> AttackManager.doSlash(entityIn, -130F, Vec3.ZERO, false, false, 0.1F))
                            .put(18, (entityIn) -> AttackManager.doSlash(entityIn, 130F, Vec3.ZERO, false, false, 0.1F))
                            .put(19, (entityIn) -> AttackManager.doSlash(entityIn, 180F, Vec3.ZERO, false, false, 0.1F))
                            .put(20, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.1F))


                            .build())
                    .addHitEffect(StunManager::setStun)
                    ::build);
    public static final RegistryObject<ComboState> ALLOVEREX = COMBO_STATES.register("all_over_ex",
            ComboState.Builder.newInstance().startAndEnd(400, 459).priority(50)
                    .motionLoc(DefaultResources.ExMotionLocation)
                    .next(ComboState.TimeoutNext.buildFromFrame(15, entity -> SlashBlade.prefix("none")))
                    .nextOfTimeout(entity -> Resonantisshelomoh.prefix("all_over_ex_alf"))
                    .addTickAction(ComboState.TimeLineTickAction.getBuilder()
                            .put(1, (entityIn) -> AttackManager.doSlash(entityIn, -30F, Vec3.ZERO, false, false, 0.2F))
                            .put(2, (entityIn) -> AttackManager.doSlash(entityIn, 30F, Vec3.ZERO, false, false, 0.2F))
                            .put(3, (entityIn) -> AttackManager.doSlash(entityIn, -40F, Vec3.ZERO, false, false, 0.2F))
                            .put(4, (entityIn) -> AttackManager.doSlash(entityIn, 40F, Vec3.ZERO, false, false, 0.2F))
                            .put(5, (entityIn) -> AttackManager.doSlash(entityIn, 50F, Vec3.ZERO, false, false, 0.2F))
                            .put(6, (entityIn) -> AttackManager.doSlash(entityIn, -50F, Vec3.ZERO, false, false, 0.2F))
                            .put(7, (entityIn) -> AttackManager.doSlash(entityIn, -60F, Vec3.ZERO, false, false, 0.2F))
                            .put(8, (entityIn) -> AttackManager.doSlash(entityIn, 60F, Vec3.ZERO, false, false, 0.2F))
                            .put(9, (entityIn) -> AttackManager.doSlash(entityIn, -70F, Vec3.ZERO, false, false, 0.2F))
                            .put(10, (entityIn) -> AttackManager.doSlash(entityIn, 70F, Vec3.ZERO, false, false, 0.2F))
                            .put(11, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .put(12, (entityIn) -> AttackManager.doSlash(entityIn, -90F, Vec3.ZERO, false, false, 0.2F))
                            .put(13, (entityIn) -> AttackManager.doSlash(entityIn, 110F, Vec3.ZERO, false, false, 0.2F))
                            .put(14, (entityIn) -> AttackManager.doSlash(entityIn, -110F, Vec3.ZERO, false, false, 0.2F))
                            .put(15, (entityIn) -> AttackManager.doSlash(entityIn, 120F, Vec3.ZERO, false, false, 0.2F))
                            .put(16, (entityIn) -> AttackManager.doSlash(entityIn, -120F, Vec3.ZERO, false, false, 0.2F))
                            .put(17, (entityIn) -> AttackManager.doSlash(entityIn, -130F, Vec3.ZERO, false, false, 0.2F))
                            .put(18, (entityIn) -> AttackManager.doSlash(entityIn, 130F, Vec3.ZERO, false, false, 0.2F))
                            .put(19, (entityIn) -> AttackManager.doSlash(entityIn, 180F, Vec3.ZERO, false, false, 0.2F))
                            .put(20, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .build())
                    .addHitEffect(StunManager::setStun)
                    ::build);
    public static final RegistryObject<ComboState> ALLOVEREX_ALF = COMBO_STATES.register("all_over_ex_alf",
            ComboState.Builder.newInstance().startAndEnd(400, 459).priority(50)
                    .motionLoc(DefaultResources.ExMotionLocation)
                    .next(ComboState.TimeoutNext.buildFromFrame(15, entity -> SlashBlade.prefix("none")))
                    .nextOfTimeout(entity -> Resonantisshelomoh.prefix("all_reuse"))
                    .addTickAction(ComboState.TimeLineTickAction.getBuilder()
                            .put(1, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .put(2, (entityIn) -> AttackManager.doSlash(entityIn, 180F, Vec3.ZERO, false, false, 0.2F))
                            .build())
                    .addHitEffect(StunManager::setStun)
                    ::build);
    public static final RegistryObject<ComboState> ALLOVEREX2 = COMBO_STATES.register("all_over_ex2",
            ComboState.Builder.newInstance().startAndEnd(400, 459).priority(50)
                    .motionLoc(DefaultResources.ExMotionLocation)
                    .next(ComboState.TimeoutNext.buildFromFrame(15, entity -> SlashBlade.prefix("none")))
                    .nextOfTimeout(entity -> Resonantisshelomoh.prefix("all_over_ex_alf2"))
                    .addTickAction(ComboState.TimeLineTickAction.getBuilder()
                            .put(1, (entityIn) -> AttackManager.doSlash(entityIn, -30F, Vec3.ZERO, false, false, 0.2F))
                            .put(2, (entityIn) -> AttackManager.doSlash(entityIn, 30F, Vec3.ZERO, false, false, 0.2F))
                            .put(3, (entityIn) -> AttackManager.doSlash(entityIn, -40F, Vec3.ZERO, false, false, 0.2F))
                            .put(4, (entityIn) -> AttackManager.doSlash(entityIn, 40F, Vec3.ZERO, false, false, 0.2F))
                            .put(5, (entityIn) -> AttackManager.doSlash(entityIn, 50F, Vec3.ZERO, false, false, 0.2F))
                            .put(6, (entityIn) -> AttackManager.doSlash(entityIn, -50F, Vec3.ZERO, false, false, 0.2F))
                            .put(7, (entityIn) -> AttackManager.doSlash(entityIn, -60F, Vec3.ZERO, false, false, 0.2F))
                            .put(8, (entityIn) -> AttackManager.doSlash(entityIn, 60F, Vec3.ZERO, false, false, 0.2F))
                            .put(9, (entityIn) -> AttackManager.doSlash(entityIn, -70F, Vec3.ZERO, false, false, 0.2F))
                            .put(10, (entityIn) -> AttackManager.doSlash(entityIn, 70F, Vec3.ZERO, false, false, 0.2F))
                            .put(11, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .put(12, (entityIn) -> AttackManager.doSlash(entityIn, -90F, Vec3.ZERO, false, false, 0.2F))
                            .put(13, (entityIn) -> AttackManager.doSlash(entityIn, 110F, Vec3.ZERO, false, false, 0.2F))
                            .put(14, (entityIn) -> AttackManager.doSlash(entityIn, -110F, Vec3.ZERO, false, false, 0.2F))
                            .put(15, (entityIn) -> AttackManager.doSlash(entityIn, 120F, Vec3.ZERO, false, false, 0.2F))
                            .put(16, (entityIn) -> AttackManager.doSlash(entityIn, -120F, Vec3.ZERO, false, false, 0.2F))
                            .put(17, (entityIn) -> AttackManager.doSlash(entityIn, -130F, Vec3.ZERO, false, false, 0.2F))
                            .put(18, (entityIn) -> AttackManager.doSlash(entityIn, 130F, Vec3.ZERO, false, false, 0.2F))
                            .put(19, (entityIn) -> AttackManager.doSlash(entityIn, 180F, Vec3.ZERO, false, false, 0.2F))
                            .put(20, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .build())
                    .addHitEffect(StunManager::setStun)
                    ::build);
    public static final RegistryObject<ComboState> ALLOVEREX_ALF2 = COMBO_STATES.register("all_over_ex_alf2",
            ComboState.Builder.newInstance().startAndEnd(400, 459).priority(50)
                    .motionLoc(DefaultResources.ExMotionLocation)
                    .next(ComboState.TimeoutNext.buildFromFrame(15, entity -> SlashBlade.prefix("none")))
                    .nextOfTimeout(entity -> Resonantisshelomoh.prefix("all_over_ex2_2"))
                    .addTickAction(ComboState.TimeLineTickAction.getBuilder()
                            .put(1, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .put(2, (entityIn) -> AttackManager.doSlash(entityIn, 180F, Vec3.ZERO, false, false, 0.2F))
                            .build())
                    .addHitEffect(StunManager::setStun)
                    ::build);
    public static final RegistryObject<ComboState> ALLOVEREX2_2 = COMBO_STATES.register("all_over_ex2_2",
            ComboState.Builder.newInstance().startAndEnd(400, 459).priority(50)
                    .motionLoc(DefaultResources.ExMotionLocation)
                    .next(ComboState.TimeoutNext.buildFromFrame(15, entity -> SlashBlade.prefix("none")))
                    .nextOfTimeout(entity -> Resonantisshelomoh.prefix("all_over_ex_alf2_2"))
                    .addTickAction(ComboState.TimeLineTickAction.getBuilder()
                            .put(1, (entityIn) -> AttackManager.doSlash(entityIn, -30F, Vec3.ZERO, false, false, 0.2F))
                            .put(2, (entityIn) -> AttackManager.doSlash(entityIn, 30F, Vec3.ZERO, false, false, 0.2F))
                            .put(3, (entityIn) -> AttackManager.doSlash(entityIn, -40F, Vec3.ZERO, false, false, 0.2F))
                            .put(4, (entityIn) -> AttackManager.doSlash(entityIn, 40F, Vec3.ZERO, false, false, 0.2F))
                            .put(5, (entityIn) -> AttackManager.doSlash(entityIn, 50F, Vec3.ZERO, false, false, 0.2F))
                            .put(6, (entityIn) -> AttackManager.doSlash(entityIn, -50F, Vec3.ZERO, false, false, 0.2F))
                            .put(7, (entityIn) -> AttackManager.doSlash(entityIn, -60F, Vec3.ZERO, false, false, 0.2F))
                            .put(8, (entityIn) -> AttackManager.doSlash(entityIn, 60F, Vec3.ZERO, false, false, 0.2F))
                            .put(9, (entityIn) -> AttackManager.doSlash(entityIn, -70F, Vec3.ZERO, false, false, 0.2F))
                            .put(10, (entityIn) -> AttackManager.doSlash(entityIn, 70F, Vec3.ZERO, false, false, 0.2F))
                            .put(11, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .put(12, (entityIn) -> AttackManager.doSlash(entityIn, -90F, Vec3.ZERO, false, false, 0.2F))
                            .put(13, (entityIn) -> AttackManager.doSlash(entityIn, 110F, Vec3.ZERO, false, false, 0.2F))
                            .put(14, (entityIn) -> AttackManager.doSlash(entityIn, -110F, Vec3.ZERO, false, false, 0.2F))
                            .put(15, (entityIn) -> AttackManager.doSlash(entityIn, 120F, Vec3.ZERO, false, false, 0.2F))
                            .put(16, (entityIn) -> AttackManager.doSlash(entityIn, -120F, Vec3.ZERO, false, false, 0.2F))
                            .put(17, (entityIn) -> AttackManager.doSlash(entityIn, -130F, Vec3.ZERO, false, false, 0.2F))
                            .put(18, (entityIn) -> AttackManager.doSlash(entityIn, 130F, Vec3.ZERO, false, false, 0.2F))
                            .put(19, (entityIn) -> AttackManager.doSlash(entityIn, 180F, Vec3.ZERO, false, false, 0.2F))
                            .put(20, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .build())
                    .addHitEffect(StunManager::setStun)
                    ::build);
    public static final RegistryObject<ComboState> ALLOVEREX_ALF2_2 = COMBO_STATES.register("all_over_ex_alf2_2",
            ComboState.Builder.newInstance().startAndEnd(400, 459).priority(50)
                    .motionLoc(DefaultResources.ExMotionLocation)
                    .next(ComboState.TimeoutNext.buildFromFrame(15, entity -> SlashBlade.prefix("none")))
                    .nextOfTimeout(entity -> Resonantisshelomoh.prefix("all_reuse"))
                    .addTickAction(ComboState.TimeLineTickAction.getBuilder()
                            .put(1, (entityIn) -> AttackManager.doSlash(entityIn, 90F, Vec3.ZERO, false, false, 0.2F))
                            .put(2, (entityIn) -> AttackManager.doSlash(entityIn, 180F, Vec3.ZERO, false, false, 0.2F))
                            .build())
                    .addHitEffect(StunManager::setStun)
                    ::build);

}
